package com.qd.common.panda.domain.entity.carpark;

import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalTime;

/**
 * 充电计费时段
 *
 * @author sjk
 */
@Getter
@Setter
public class CarParkChargeTimeDTO {

    /**
     * 主键
     */
    @NotBlank(message = "时段ID不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 50, message = "时段ID长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String tid;
    /**
     * 原价
     */
    @NotNull(message = "原价不能为空", groups = DefaultGroup.class)
    private BigDecimal originalPrice;
    /**
     * 原价显示
     */
    private String originalPriceDisplay;
    /**
     * 优惠价
     */
    private BigDecimal concessionalRate;
    /**
     * 原价显示
     */
    private String concessionalRateDisplay;
    /**
     * 服务费
     */
    private BigDecimal serviceCharge;
    /**
     * 服务费显示
     */
    private String serviceChargeDisplay;
    /**
     * 电费
     */
    private BigDecimal electricityFees;
    /**
     * 电费显示
     */
    private String electricityFeesDisplay;
    /**
     * 开始时间
     */
    @NotNull(message = "开始时间不能为空", groups = DefaultGroup.class)
    private LocalTime startTime;
    /**
     * 结束时间
     */
    @NotNull(message = "结束时间不能为空", groups = DefaultGroup.class)
    private LocalTime endTime;
    /**
     * 停车场标识
     */
    @NotBlank(message = "停车场标识不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "停车场标识长度不能超过{max}位", groups = DefaultGroup.class)
    @JsonProperty("pId")
    private String pId;
    /**
     * 是否当前时段
     */
    private String currentTime;

    public void freeData() {
        this.tid = null;
        this.originalPrice = null;
        this.originalPriceDisplay = null;
        this.concessionalRate = null;
        this.concessionalRateDisplay = null;
        this.serviceCharge = null;
        this.serviceChargeDisplay = null;
        this.electricityFees = null;
        this.electricityFeesDisplay = null;
        this.startTime = null;
        this.endTime = null;
        this.pId = null;
        this.currentTime = null;
    }
}
